/******************************************************************************
 * Copyright (C) 2021 Batonova
 * All rights reserved.
 *****************************************************************************/

/**
 * @file ISerializer.h
 * @brief An Interface for serializer.
 *
 * A serializer is a helper object of the communication layer
 * of Deviceware, it is used to serializing data from Requests,
 * Responses and Notifications.
 *
 * @author batonova
 * @date 21 June 2021
 */

#ifndef _DRA_COM_ISERIALIZER_H_
#define _DRA_COM_ISERIALIZER_H_

#include <array>
#include <map>
#include <unordered_map>
#include <memory>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
#include "serialize/typedefine.h"
// #include "ara/core/error_code.h"
#include "serialize/ProtocolDef.h"

namespace dra {
namespace com {

// using namespace deviceware::base;  // NOLINT

/** @addtogroup communication
 * @brief common interfaces of dra.com
 *
 * @{
 */

/**
 * @brief An Interface for serializer.
 *
 * A serializer is a helper object of the communication layer
 * of Deviceware, it is used to serializing data from Requests,
 * Responses and Notifications.
 *
 */
class ISerializer {
public:
    virtual ~ISerializer() {
    }

    /**
     * @brief Set a BOOLEAN value to serializer.
     *
     * @param[in] b the BOOLEAN value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setBoolean(BOOLEAN b) = 0;

    /**
     * @brief Set a INT8 value to serializer.
     *
     * @param[in] i the INT8 value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setInt8(INT8 i) = 0;

    /**
     * @brief Set a INT16 value to serializer.
     *
     * @param[in] i the INT16 value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setInt16(INT16 i) = 0;

    /**
     * @brief Set a INT32 value to serializer.
     *
     * @param[in] i the INT32 value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setInt32(INT32 i) = 0;

    /**
     * @brief Set a INT64 value to serializer.
     *
     * @param[in] i the INT64 value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setInt64(INT64 i) = 0;

    /**
     * @brief Set a UINT8 value to serializer.
     *
     * @param[in] i the UINT8 value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setUInt8(UINT8 i) = 0;

    /**
     * @brief Set a UINT16 value to serializer.
     *
     * @param[in] i the UINT16 value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setUInt16(UINT16 i) = 0;

    /**
     * @brief Set a UINT32 value to serializer.
     *
     * @param[in] i the UINT32 value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setUInt32(UINT32 i) = 0;

    /**
     * @brief Set a UINT64 value to serializer.
     *
     * @param[in] i the UINT64 value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setUInt64(UINT64 i) = 0;

    /**
     * @brief Set a FLOAT32 value to serializer.
     *
     * @param[in] f the FLOAT32 value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setFloat32(FLOAT32 f) = 0;

    /**
     * @brief Set a FLOAT64 value to serializer.
     *
     * @param[in] f the FLOAT64 value serialized to serializer,
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setFloat64(FLOAT64 f) = 0;

    /**
     * @brief Set a string to serializer.
     *
     * @param[out] str the pointer of string buffer serialized to serializer
     * @param[out] strLen the length of string buffer serialized to serializer
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setString(CHAR const* str, INT32 strLen) = 0;

    /**
     * @brief Set a File Descriptor to serializer.
     *
     * @param[in] fd the File Descriptor serialized to serializer
     * @return true if serialization is succeed else false.
     */
    virtual BOOLEAN setFD(INT32 fd) = 0;

    /**
    *-----------------------------------------------------------------------------
     * @brief Get the Proto Type
     * 
     * @return SERIALIZE_TYPE 
     *-----------------------------------------------------------------------------
    */
    virtual SERIALIZE_TYPE GetSerializeType() = 0;
};

}  // namespace com
}  // namespace dra

#endif  // _DRA_COM_ISERIALIZER_H_
